import java.util.Random;

public class J04return {
    public static void main(String[] args) {
        Random r = new Random();
        int num = r.nextInt(11);
        // 函数执行完毕，可以返回一些信息
        int num1 = onSum();
        System.out.println("num1 = " + num1);
        System.out.println("======");
        int sum2 = onSum2(4,5);
        System.out.println("sum2 = " + sum2);
        System.out.println(onSum2(100,200));//300
    }

    public static int onSum2(int a,int b){
        return a+b;
    }
    //有返回值，并且类型是int
    public static int onSum(){
        return 40;
    }
    //void，没有返回值
    public static void onSum0(){
//        return 3;
    }
}

class J04return2{
    public static void main(String[] args) {
        System.out.println(getRandom5_10());
        System.out.println(getRandom5_10());
        System.out.println(getRandom5_10());
        System.out.println(getRandom5_10());
        System.out.println(getRandom5_10());
    }
    //方法，函数
    //5-10
    public static int getRandom5_10(){
        Random r = new Random();
        int num = r.nextInt(10-5+1)+5;
        return num;
    }
}
// return 结束函数执行
class J04over{
    public static void main(String[] args) {
        f1();
    }
    public static void f1(){
        System.out.println("i am f1");
        if(J04return2.getRandom5_10()>0){
            return;
        }
        System.out.println("f1 end");
//        return;
//        System.out.println(5);
    }
}